<?php
declare (strict_types = 1);

namespace app\system\controller;

use hehe\Arr;
use Throwable;
use ba\ClickCaptcha;
use think\facade\Config;
use think\facade\Validate;
use app\common\facade\Token;
use app\system\model\AdminLog;
use app\common\controller\System;
use think\facade\Db;
class Test extends System {
    protected array $noNeedLogin = ['*'];
    protected array $noNeedPermission = ['index'];


    public function xiufu(){
        $result = db::name('customer_order_file')->select();
die;
        foreach($result as $val){
            $update = [
                'update_time' => $this->timestamp
            ];
            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }

            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }

            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }
            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }
            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }
            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }
            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }
            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }
            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }
            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }
            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }
            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }
            if(!empty($val['customer_contract'])){
                $customer_contract = json_decode($val['customer_contract'], true);
                if(!empty($customer_contract)){
                    $depth = Arr::arrayDepth($customer_contract);
                    if($depth == 1){
                        $update['customer_contract'] = json_encode([$customer_contract]);
                    }
                }
            }

            db::name('customer_order_file')->where(['id' => $val['id']])->update($update);


        }

    }

}
